//
//  OneColumnLayOut.swift
//  lookLikeIweekly
//
//  Created by Mainzxq on 16/6/12.
//  Copyright © 2016年 Mainzxq. All rights reserved.
//

import UIKit

class OneColumnLayOut: UICollectionViewFlowLayout {
    var itemCount: Int
    
    init(count:Int) {
        self.itemCount = count
        super.init()
        self.itemSize = CGSize(width: UIScreen.mainScreen().bounds.width,height: 210)
        
        self.minimumLineSpacing = 0
        self.minimumInteritemSpacing = 0
        
        print("linelayout excute")
        
    }
    
    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }
    
    override func prepareLayout() {
        self.sectionInset = UIEdgeInsetsMake(0, 5, 0, 5)
        self.scrollDirection = UICollectionViewScrollDirection.Vertical
        
        
        
    }
    
    override func shouldInvalidateLayoutForBoundsChange(newBounds: CGRect) -> Bool {
        return true
    }
    
    override func collectionViewContentSize() -> CGSize {
        return CGSizeMake(UIScreen.mainScreen().bounds.width, 210*(CGFloat(itemCount)))
    }
}
